<template>
  <div class="home-container">
    <!-- 导航栏 -->
     <!-- 导航栏 -->
     <van-nav-bar class="page-nav-bar" fixed>
      <van-button slot="title" class="search-btn"
      type="info"
      size="small"
      round
      icon="search"
      to="/search"
      >搜索</van-button>
    </van-nav-bar>
    <!-- 导航栏结束 -->
    <!-- 通知 -->
    <van-notice-bar
  left-icon="volume-o"
  text="当您第一次进入系统后,需要先注册账号,然后才能成功预约"
/>
    <!-- 通知结束 -->
    <!-- 科室列表 -->
    <van-collapse v-model="activeName" accordion>
      <van-collapse-item :title="item.name" :name="item.id" v-for="(item) in departmentList" :key="item.id">
        <Doctor :DepartmentID="item.id"></Doctor>
      </van-collapse-item>
    </van-collapse>
  </div>
</template>

<script>
import { getDepartmentInfo, WaitingNumber } from '@/api/user'
import { mapState } from 'vuex'
import { getItem } from '@/utils/storage'
import Doctor from '@/views/home/components/doctor.vue'
export default {
  name: 'HomeIndex',
  data () {
    return {
      activeName: '1',
      departmentList: [],
      waitPeopleList: [] // 等待人的列表 //
    }
  },
  async created () {
    this.loadDepartment()
  },
  methods: {

    async  loadDepartment () {
      try {
        const { data: { data: res } } = await getDepartmentInfo()
        this.departmentList = res
        this.$toast.success('加载科室信息成功')
        // 获取医生列表
      } catch (err) {
        this.$toast.fail('加载科室信息失败')
      }
    }

  },
  components: {
    Doctor
  },
  computed: {
    ...mapState(['userinfo', 'setwaitPeopleList'])
  }
}
</script>

<style lang="less" scoped>
.home-container {
  padding-top: 50px;
  padding-bottom: 50px;
  .van-nav-bar {
    background-color: #3926fa;
    .van-nav-bar__title {
      max-width: unset;
    }
  }
  .search-btn {
    width: 200px;
    height: 32px;
    background-color: #5babfb;
    border: none;
    font-size: 17px;
    .van-icon {
      font-size: 20px;
      color: white;
    }
  }
  /deep/ .channel-tabs {
     .van-tabs__wrap {
       height: 41px;
        left: 0;
        z-index: 1;
        position: fixed;
        top: 46px;
        right: 0;
      }
    .van-tab {
      min-width: 100px;
      font-size: 15px;
      border-right: 1px solid #edeff3;
      color: #777;
      .van-tab--active {
        color: #333;
      }
      .van-tabs__nav {
        padding-bottom: 0;
      }
      .van-tabs__line  {
        width: 15.5px !important;
        height: 3px;
        background-color: #3926fa;
        bottom: 4px ;
      }

    }
  }
  .placeholder {
    width: 33px;
    height: 41px;
    flex-shrink: 0;
  }
  .hamburger-btn {
    position: fixed;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 33px;
    height: 41px;
    background-color: #fff;
    opacity: 0.902;
    i.toutiao {
      font-size: 16.5px;
    }
    &::before {
      content: '';
      position: absolute;
      left: 0;
      width: 1px;
      height: 100%;
      background: url('@/assets/gradient-gray-line.png');
      background-size: contain;
    }
  }
}

</style>
